package model;

/**
 * 座位实体类
 */
public class Seat {
    private int seatId;
    private String seatNumber;
    private int floor;
    private int room; // 新增房间号 (1-6)
    private int seatIndex; // 房间内座位编号 (1-8)
    private String area;
    private int status; // 0: 可用, 1: 已预约, 2: 维护中
    private String equipment; // 设备信息
    private boolean hasComputer;
    private boolean hasPowerSocket;

    public Seat() {
    }

    public Seat(int floor, int room, int seatIndex, String equipment,
            boolean hasComputer, boolean hasPowerSocket) {
        this.floor = floor;
        this.room = room;
        this.seatIndex = seatIndex;
        this.seatNumber = generateSeatNumber(floor, room, seatIndex);
        this.area = generateAreaName(floor, room);
        this.equipment = equipment;
        this.hasComputer = hasComputer;
        this.hasPowerSocket = hasPowerSocket;
        this.status = 0; // 默认可用
    }

    /**
     * 生成座位号：楼层+房间+座位 (例如: 1-2-05 表示1楼2号房间5号座位)
     */
    private String generateSeatNumber(int floor, int room, int seatIndex) {
        return String.format("%d-%d-%02d", floor, room, seatIndex);
    }

    /**
     * 生成区域名称：楼层+房间 (例如: 1楼2号房间)
     */
    private String generateAreaName(int floor, int room) {
        return floor + "楼" + room + "号房间";
    }

    // Getters and Setters
    public int getSeatId() {
        return seatId;
    }

    public void setSeatId(int seatId) {
        this.seatId = seatId;
    }

    public String getSeatNumber() {
        return seatNumber;
    }

    public void setSeatNumber(String seatNumber) {
        this.seatNumber = seatNumber;
    }

    public int getFloor() {
        return floor;
    }

    public void setFloor(int floor) {
        this.floor = floor;
    }

    public int getRoom() {
        return room;
    }

    public void setRoom(int room) {
        this.room = room;
    }

    public int getSeatIndex() {
        return seatIndex;
    }

    public void setSeatIndex(int seatIndex) {
        this.seatIndex = seatIndex;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getEquipment() {
        return equipment;
    }

    public void setEquipment(String equipment) {
        this.equipment = equipment;
    }

    public boolean isHasComputer() {
        return hasComputer;
    }

    public void setHasComputer(boolean hasComputer) {
        this.hasComputer = hasComputer;
    }

    public boolean isHasPowerSocket() {
        return hasPowerSocket;
    }

    public void setHasPowerSocket(boolean hasPowerSocket) {
        this.hasPowerSocket = hasPowerSocket;
    }

    public String getStatusText() {
        switch (status) {
            case 0:
                return "可用";
            case 1:
                return "已预约";
            case 2:
                return "维护中";
            default:
                return "未知";
        }
    }
}
